<?php $featured_products = $this->getFeaturedProducts(); ?>
<?php shuffle($featured_products); ?>
<?php $_collectionSize = count($featured_products) ?>
<div class="featuredproduct">
<div class="head">
  <h4> <span> Featured Products </span></h4>
</div>
<table cellspacing="0" class="recently-list" id="product-list-table">
<?php $i=0; foreach ($featured_products as $_res): ?>
<?php $_product = Mage::getModel('catalog/product')->load($_res['product_id']); 
Mage::log('myproduct');
Mage::log($_product);
?>
 <?php  ?>
<?php if ($i++%4==0): ?>
<tr>
<?php endif ?>
	<td>
	
		<?php if($i%4!=0):?>
			<div class="content_row1_col2_R1_c1">
			<div>
				<div class="content_detail">
					<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
					<img class="product-image-feature" style="text-align: left;" src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(151, 151); ?>" width="151" height="151" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" /> 
					</a>			
				</div>
				<div class="contentdetail">
				 <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
				    <?php echo $this->htmlEscape($_product->getName()) ?>
                 </a>					
				</div>			
				<div class="content_detail1 clearfix">
				<div class="detail"><span class="retail_lable">Retail Price: </span><?php echo $this->helper('checkout')->formatPrice($_product->getPrice()) ?></div> 					
				</div>  
            	<div class="bottom">
				 <button type="button" class="form-button" onclick="setLocation('<?php echo  Mage::helper('checkout/cart')->getAddUrl($_product);?>')"><span><?php echo $this->__('Add to Cart') ?></span></button>
		        </div>
               <div class="add-to">
                <?php if ($this->helper('wishlist')->isAllow()) : ?>
                <a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-cart"><?php echo $this->__('Add to Wishlist') ?></a>
                <?php endif; ?>
                <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
                <a href="<?php echo $_compareUrl ?>"><?php echo $this->__('Add to Compare') ?></a>
                <?php endif; ?>
            </div>		
			</div>			
			
		<?php else:?>
			<div class="content_row1_col2_R1_c2">
			 <div>
				<div class="content_detail">
					<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
						<img class="product-image-feature" src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(151, 151); ?>" width="151" height="151" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" />
					</a>
								
				</div>
				
				<div class="contentdetail">
				<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
				  <?php echo $this->htmlEscape($_product->getName()) ?>	
				</a>  
				</div>
				<div class="content_detail1 clearfix">
						<div class="detail"><span class="retail_lable">Retail Price: </span><?php echo $this->helper('checkout')->formatPrice($_product->getPrice()) ?></div> </span>
				</div>	
            	<div class="bottom">			
				   <button type="button" class="form-button" onclick="setLocation('<?php echo  Mage::helper('checkout/cart')->getAddUrl($_product);?>')"><span><?php echo $this->__('Add to Cart') ?></span></button>
				</div>
		    <div class="add-to">
                <?php if ($this->helper('wishlist')->isAllow()) : ?>
                <a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-cart"><?php echo $this->__('Add to Wishlist') ?></a>
                <?php endif; ?>
                <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
                <a href="<?php echo $_compareUrl ?>"><?php echo $this->__('Add to Compare') ?></a>
                <?php endif; ?>
            </div> 
		<?php endif;?>				
		</div>
	</td>
<?php if ($i%4==0 && $i!=$_collectionSize): ?>
</tr>
<?php endif ?>

<?php if ($i%12==0 || $i==$_collectionSize): ?>
	<?php break; ?>
<?php endif ?>
<?php endforeach ?>
<?php for($i;$i%4!=0;$i++): ?>
<td class="empty-product"></td>
<?php endfor ?>
<?php if ($i%4==0): ?>

<?php endif ?>
</table>
<script type="text/javascript">decorateTable('product-list-table')</script>
</div>
